<?php
require_once('lanceur_spip.php');
include_spip('functions/pdk_common');
//require_once(_DIR_PLUGIN_ALOHACART.'classes/ClientModel.php');
require_once(_DIR_PLUGIN_PDK.'classes/simpletest/class.PdkModelTest.php');

/**
 *  ExtensionModel class test case
 */
class TestClassAlohacartExtensionModel extends PdkModelTest {    
    
    function __construct(){
        parent::__construct();
        //$data_check = array('cost'=>'999');
        //ecrire_config('alohacart/shipping_flat', $data_check);
        $this->SetPdkModel('AlohacartExtensionModel', pdk_load_class('AlohacartExtensionModel', 'classes'));
                        
        $this->dropTestTables = TESTS_DROP_TEST_TABLES;
        
        // Remember what is written in config
        //$this->config = lire_config('alohacart/shipping_flat');
    }
        
    /**
     *  Run before each test
     */
    function setUp() {
        parent::setUp();
    }
    
    /**
     *  Run after each test
     */
    function tearDown() {
        parent::tearDown();
    }
    
    function __destruct() {
        parent::__destruct();
        // Rewrite config
        //ecrire_config('alohacart/shipping_flat', $this->config);
    }
    
    function Test_GetExtensionClass() {
        $extension = $this->model->GetExtensionClass(array("id_extension=1","code='flat'"));
        $this->assertIsA($extension, 'AlohacartShippingFlat');
    }
    
    function Test_GetExtensionClassByID() {
        $extension = $this->model->GetExtensionClassByID(1);
        $this->assertIsA($extension, 'AlohacartShippingFlat');
    } 
    
    function Test_GetExtensionClassByCode() {
        $extension = $this->model->GetExtensionClassByCode('flat');
        $this->assertIsA($extension, 'AlohacartShippingFlat');
    }
}